﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<div class="modal-dialog x-modal-dialog" style="width:600px; margin-top: 150px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>编辑活动&nbsp;-&nbsp;基本信息</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form class="form-horizontal" method="POST" action="${ctx.host}/activities/${activity.id }" data-validate="true">
    
      <input type="hidden" name="_method" value="PATCH">
      <input type="hidden" name="id" value="${activity.id }">
      <div class="modal-body">
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">活动名称</label>
          <div class="pull-left col-xs-8">
            <input type="text" name="name" value="${activity.name}" class="form-control" data-validate="required">
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">活动时间</label>
          <div class="pull-left col-xs-8 input-group" style="padding: 0 15px;">
            <input type="text" class="form-control date" name="beginDate" value="<fmt:formatDate value="${activity.beginDate}" pattern="yyyy-MM-dd"/>" readonly placeholder="请输入开始时间" aria-describedby="basic-addon2">
            <span class="input-group-addon" id="basic-addon2">至</span>
            <input type="text" class="form-control date" name="endDate" value="<fmt:formatDate value="${activity.endDate}" pattern="yyyy-MM-dd"/>" readonly placeholder="请输入结束时间" aria-describedby="basic-addon2">
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">活动简介</label>
          <div class="pull-left col-xs-8">
            <textarea data-validate="required" name="summary" rows="5" style="width: 100%;">${activity.summary}</textarea>
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">活动链接</label>
          <div class="pull-left col-xs-8">
            <textarea data-validate="required|www" name="link" rows="5" style="width: 100%;">${activity.link}</textarea>
          </div>
        </div>
        
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>
    </form>

  </div>

</div>

<script src="${ctx.resource}/js/component/bootstrap.validate.js"></script>
<script src="${ctx.resource}/js/component/bootstrap.validate.en.js"></script>
<script src="${ctx.resource}/js/bootstrap.validate.trigger.js"></script>
<script>
$(document).ready(function(){
	
  $('.date').datetimepicker({
    format: 'yyyy-mm-dd',
    autoclose: true,
    language: 'zh-CN',
    todayBtn: 'linked',
    todayHighlight: true,
    pickerPosition: 'bottom-right',
    minView: 'month'
  })
});
</script>